import { h } from "vue";
import { DatePickerProps, InputProps, NSwitch, SelectProps } from "naive-ui";
import { TableColumns } from "@/type";

export const ruleColumns = (): TableColumns => {
  return [
    {
      type: "selection",
      width: "40px",
      fixed: "left",
      hideInForm: true,
      hideInSearch:true,
    },
    {
      title: "序号",
      key: "id",
      width: "60px",
      align: "center",
      fixed: "left",
      hideInForm: true,
      hideInSearch:true,
    },
    {
      title: "规则名称",
      key: "ruleName",
      width: "50px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "input",
      formItemProps: {
        placeholder: "请输入",
      } as InputProps,
    },
    {
      title: "规则类型",
      key: "ruleType",
      width: "50px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "select",
      formItemProps: {
        placeholder: "请选择",
        options: [
          {
            label: "规则类型1",
            value: "ruleType1",
          },
          {
            label: "规则类型2",
            value: "ruleType2",
          },
          {
            label: "规则类型3",
            value: "ruleType3",
          },
          {
            label: "规则类型4",
            value: "ruleType4",
          },
          {
            label: "规则类型5",
            value: "ruleType5",
          },
        ],
      } as SelectProps,
    },
    {
      title: "主题表",
      key: "topicTable",
      width: "100px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "select",
      formItemProps: {
        placeholder: "请选择",
        options: [
          {
            label: "ABC",
            value: "topicTable1",
          },
          {
            label: "TopocTable2",
            value: "topicTable2",
          },
          {
            label: "topicTable3",
            value: "topicTable3",
          },
          {
            label: "topicTable4",
            value: "topicTable4",
          },
          {
            label: "topicTable5",
            value: "topicTable5",
          },
        ],
      } as SelectProps,
      hideInSearch:true,
    },
    {
      title: "检查字段",
      key: "checkField",
      width: "100px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "select",
      formItemProps: {
        placeholder: "请选择",
        options: [
          {
            label: "姓名、性别、年龄",
            value: "chcekField1",
          },
          {
            label: "姓名、性别、年龄、身份证号码",
            value: "chcekField2",
          },
          {
            label: "身高、体重、血压",
            value: "chcekField3",
          },
          {
            label: "姓名、性别、年龄、身份证号码、身高、体重、血压",
            value: "chcekField4",
          },
          {
            label: "体温、血糖、血氧、血压、心率",
            value: "chcekField5",
          },
        ],
      } as SelectProps,
      hideInSearch:true,
    },
    {
      title: "关联ETL包",
      key: "etlPackage",
      width: "100px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "select",
      formItemProps: {
        placeholder: "请选择",
        options: [
          {
            label: "ABC_ETL_1",
            value: "ETL包1",
          },
          {
            label: "ABC_ETL_2",
            value: "ETL包2",
          },
          {
            label: "ABC_ETL_3",
            value: "ETL包3",
          },
          {
            label: "ABC_ETL_4",
            value: "ETL包4",
          },
          {
            label: "ABC_ETL_5",
            value: "ETL包5",
          },
        ],
      } as SelectProps,
      hideInSearch:true,
    },
    {
      title: "状态",
      key: "status",
      width: "60px",
      align: "center",
      render(row: any) {
        return [
          h(NSwitch, {
            value: row.status,
            onClick: () => {
              row.status = !row.status;
            },
          }),
        ];
      },
      category: "switch",
      hideInSearch:true,
    },
    {
      title: "创始人",
      key: "creator",
      width: "50px",
      align: "center",
      category: "input",
      formItemProps: {
        placeholder: "请填写",
      } as InputProps,
      hideInSearch:true,
    },
    {
      title: "创建时间",
      key: "createTime",
      width: "80px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "datetime",
      formItemProps: {
        placeholder: "请选择",
        type:'datetime',
        options: [],
        style:{
          width:'100%'
        }
      } as DatePickerProps,
    },
    {
      title: "描述",
      key: "description",
      width: "100px",
      align: "center",
      ellipsis: {
        tooltip: true,
      },
      category: "input",
      formItemProps: {
        placeholder: "请填写",
        type:'textarea',
        minRows: 3,
        maxRows: 6,
      } as InputProps,
      hideInSearch:true,
    },
  ];
};
